﻿using IPR_StudyMeetingMrgSys.Enums;
using IPR_StudyMeetingMrgSys.Extension;
using IPR_StudyMeetingMrgSys.Models;
using IPR_StudyMeetingMrgSys.ViewModel;
using IPR_StudyMeetingMrgSys.Common;

using log4net;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Web;
using System.Web.Http;
using System.Web.Http.Cors;
using System.IO;
using System.Net.Http.Headers;

namespace IPR_StudyMeetingMrgSys.Controllers
{
    public class VideosController : ApiController
    {
        ILog log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
         
        [HttpGet]
        [Route("api/Videos/GetVideo")]
        public HttpResponseMessage GetVideo(string filename, string ext)
        {
            var video = new VideoStream(filename, ext);
            Action<Stream, HttpContent, TransportContext> send = video.WriteToStream;
            var response = Request.CreateResponse();
            response.Content = new System.Net.Http.PushStreamContent(send, new MediaTypeHeaderValue("video/" + ext));
            //调用异步数据推送接口
            return response;
        }
    }
}
